v5.1
自己インストール カスタム オペレータのインスタンスを作成し、それを指定された入力および出力に接続します。
このコマンドは、ほとんどの自己インストール カスタム オペレータをインスタンス化する場合に便利です。1
つのコマンドで、CustomOperator.AddInputPort、CustomOperator.AddOutputPort、CustomOperator.AddIOPort、および
Operator.Connect
の呼び出しの機能を組み合わせることができるためです。
入力リストおよび出力リストのオブジェクトは、オペレータが読み取りまたは書き込みを行う特定のデータである必要があります。
たとえば、X3DObject
を入力または出力として指定するのは不正ですが、型がCluster、Property、Parameter、Primitive、または KinematicState
のオブジェクトはすべて有効な接続です。
このコマンドが適しているのは、自己インストール プラグインの内部で定義されるオペレータを作成する場合だけです。
プリセットベースのオペレータをインスタンス化するには、ApplyOp
を使用します。 ランタイム オペレータをインスタンス化するには、AddScriptedOp を使用します。
このコマンドは、Port を 1 つの PortGroup
に追加することによってすべての接続を確立し、オペレータに接続されるオブジェクトすべてがすでにシーンに存在するとみなします。
注: 複数の PortGroup を使用する、よりダイナミックなオペレータを定義するには、このコマンドよりも高度なメソッドを
CustomOperator
オブジェクトで使用する必要があります。
oReturn = AddCustomOp( Type, OutputObjs, [InputObjs], [Name], [ConstructionMode] ); |
新しく作成された CustomOperator。
| パラメータ | タイプ | 詳細 |
|---|---|---|
| タイプ | 文字列 | Operator を実装する自己インストール PluginItem の名前。 プラグインがインストールされていないと、このコマンドはエラーになります。 |
| OutputObjs | List | オペレータの出力接続。 何も指定されていない場合は、現在の Selection が使用されます。 ほとんどのオペレータは、1 つの Output オブジェクトに接続するだけです。 |
| InputObjs | List | オペレータの入力接続。 何も指定されていない場合は、オペレータは入力を使用しません。
デフォルト値:"" (空のリスト) |
| Name | 文字列 | 新しいオペレータの名前。
デフォルト値:指定されていない場合は、オペレータの命名に Type 引数が使用されます。 |
| ConstructionMode | siConstructionMode | オペレータを適用するコンストラクション モードを指定します。 これは、Geometry
オブジェクトに対して確立された出力接続にのみ適用されます。その他のすべての接続タイプでは、モードは無視されます。
デフォルト値:現在のコンストラクション モードを使用 |
/*
Create an operator called "DemoOp". The type of the operator is "EmptyOp", which
is a very basic operator that does nothing.
This operator reads from a Local transform of a Null and the Geometry of a Sphere
and outputs to the Global transform of another Null
*/
NewScene( null, false );
var oOutput = ActiveSceneRoot.AddNull( "Out" ).Kinematics.Global ;
var oInput1 = ActiveSceneRoot.AddNull( "In1" ).Kinematics.Local ;
var oInput2 = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface", "In2" ).ActivePrimitive ;
var oOp = AddCustomOp(
"EmptyOp",
oOutput,
[oInput1,oInput2],
"DemoOp"
) ;
|
/*
Create an operator called DemoParamOp that outputs to the PosX parameter of
the global transform of a null.
This operator is of type "EmptyOp" and it has no inputs so its only effect
is to force the value of the parameter to remain at 0.0
*/
NewScene( null, false );
var oOutput = ActiveSceneRoot.AddNull( "Out" ).Kinematics.Global.Parameters( "posx" ) ;
var oOp = AddCustomOp(
"EmptyOp",
oOutput,
null,
"DemoParamOp"
) ;
|
/*
Create an operator called DemoManyInputs that reads from the visibility
property of ten nulls and outputs to the geometry of a Grid. Because it
uses the EmptyOp operator, it does nothing.
*/
var oInputs = new ActiveXObject( "XSI.Collection" ) ;
for ( var i = 0 ; i < 10 ; i++ )
{
var oNull = ActiveSceneRoot.AddNull( "Input" + i ) ;
oInputs.Add( oNull.Properties( "Visibility" ) ) ;
}
var oGrid = ActiveSceneRoot.AddGeometry( "grid", "MeshSurface", "Output" ) ;
SelectObj( oGrid.ActivePrimitive ) ;
AddCustomOp(
"EmptyOp",
null, // Softimage will use the selection
oInputs,
"DemoManyInputs" ) ;
|